import os 
from . import args
from . import strtools

def getAccountKeyPath(subpath:str)->str:
    return file_path_join(args.AccountKeyPath,subpath)

# def getPathFromServerRoot(subpath:str):
#     return _file_path_join(args.SEVER_ROOT_PATH,subpath)

def getABETmpPath(subpath:str)->str:
    return file_path_join(args.TmpABEFolder,subpath)

def file_path_join(pre,post):
    if not post:
        return pre 
    if post[0]=="/":
        return os.path.join(pre,post[1:])
    return os.path.join(pre,post)

def makedirs(path:str):
    if os.path.exists(path):
        return 
    os.makedirs(path)

makedirs(args.AccountKeyPath)
makedirs(args.TmpFolder)
makedirs(args.TmpKeysFolder)